gitweb: configurable home link string
PATCH 1/1 gitweb: configurable home link string
I've always found difficult to figure out git URL for clone from gitweb URL because git:// and http:// are different on many site including kernel.org.
I've found this enhancement at http://dev.laptop.org/git when I was on git channel, and thought that it'd be nice if all public gitweb site show it's git URL on its page.
This patch allow us to change the home link string. The current default is "projects" as we all see on gitweb now.
ie. kernel.org might set this variable to "git://git.kernel.org/pub/scm/"
--- Makefile | 2 ++ gitweb/gitweb.perl | 5 ++++- 2 files changed, 6 insertions(+), 1 deletions(-)
Makefile +2 -0
@@ -123,6 +123,7 @@ # DESTDIR= # default configuration for gitweb GITWEB_CONFIG = gitweb_config.perl +GITWEB_HOME_LINK_STR = projects GITWEB_SITENAME = GITWEB_PROJECTROOT = /pub/git GITWEB_LIST =
@@ -617,6 +618,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ -e 's|++GIT_BINDIR++|$(bindir)|g' \ -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ + -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
gitweb/gitweb.perl +4 -1
@@ -36,6 +36,9 @@ our $git_temp = "/tmp/gitweb"; # target of the home link on top of all pages our $home_link = $my_uri; +# string of the home link on top of all pages +our $home_link_str = "++GITWEB_HOME_LINK_STR++"; + # name of your site or organization to appear in page titles # replace this with something more descriptive for clearer bookmarks our $site_name = "++GITWEB_SITENAME++" || $ENV{'SERVER_NAME'} || "Untitled";
@@ -890,7 +893,7 @@ EOF "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/\" title=\"git documentation\">" . "<img src=\"$logo\" width=\"72\" height=\"27\" alt=\"git\" style=\"float:right; border-width:0px;\"/>" . "</a>\n"; - print $cgi->a({-href => esc_param($home_link)}, "projects") . " / "; + print $cgi->a({-href => esc_param($home_link)}, $home_link_str) . " / "; if (defined $project) { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, esc_html($project)); if (defined $action) {
Signature · 1 line
1.4.2.g182a
Quoted 8 lines · Yasushi SHOJI
I've always found difficult to figure out git URL for clone from gitweb URL because
git://and http:// are different on many site including kernel.org.I've found this enhancement at http://dev.laptop.org/git when I was on git channel, and thought that it'd be nice if all public gitweb site show it's git URL on its page.
Quoted 6 lines
This patch allow us to change the home link string. The current default is "projects" as we all see on gitweb now.
ie. kernel.org might set this variable to "
git://git.kernel.org/pub/scm/"Signed-off-by Yasushi SHOJI <[email protected]>
There is similar improvement in gitweb-xmms2, where the git clone/fetch URL for an individual project is visible in the "summary" page for project, see e.g.
http://git.xmms.se/?p=gitweb-xmms2.git;a=summary
I plan on implementing such a feature, with an improvement that URL is not displayed if $git_base_url (your $home_link_str) is not defined (e.g. repository is not published)... or you can reimplement this feature.
http://git.xmms.se/?p=gitweb-xmms2.git;a=commit;h=8e327dfbdebedd0c5fc02fe606fd4675b43237d7
Signature · 3 lines
Jakub Narebski Warsaw, Poland ShadeHawk on #git
hoi :)
Quoted 2 lines · Jakub Narebski
There is similar improvement in gitweb-xmms2, where the git clone/fetch URL for an individual project is visible in the "summary" page for project,
doesn't it make more sense to make it more easy to use the same URL for git:, http: and gitweb?
Signature · 1 line
Martin Waitz
Quoted 6 lines · Martin Waitz
Quoted 2 lines · Jakub Narebski
There is similar improvement in gitweb-xmms2, where the git clone/fetch URL for an individual project is visible in the "summary" page for project,
doesn't it make more sense to make it more easy to use the same URL for git:, http: and gitweb?
It is not always possible to use the same URL for gitweb and http://
access, for example gitweb might require /cgi-bin/ in path. git:// and git+ssh:// access migh need different path than http:// access.
With PATH_INFO for 'project' parameter actually used gitweb link would be the same as http:// access link; the problem would be to differentiate which handle using gitweb.cgi, and which handle directly.
Signature · 1 line
Jakub Narebski
Quoted 11 lines · Jakub Narebski
Quoted 3 lines · Martin Waitz
doesn't it make more sense to make it more easy to use the same URL for git:, http: and gitweb?
It is not always possible to use the same URL for gitweb and http://
access, for example gitweb might require /cgi-bin/ in path.git://and git+ssh:// access migh need different path than http:// access.With
PATH_INFOfor 'project' parameter actually used gitweb link would be the same as http:// access link;
And for someone who has enough control to make consistent URLs happen, could anyone provide guidance on how to make this work? Specifically, I'm interested in getting at the PATH_INFO for project functionality.
Currently I've got gitweb running at the root URL on its own domain with the following apache configuration:
ScriptAlias / /usr/lib/cgi-bin/gitweb
So I can currently browse a project with something like:
http://gitweb.freedesktop.org/?p=cairo.git
But if I try to put the project name as part of the path:
http://gitweb.freedesktop.org/cairo.git
Then I just get a 404. So what do I need to configure to get the PATH_INFO stuff to work?
Also, is there support in gitweb for not requiring the ".git" suffix even though that exists in the directory on the filesystem? The URL I really want to use is:
http://gitweb.freedesktop.org/cairo
Finally, once I get that working, I would like gitweb to generate URLs of this form in the link it generates. Does it have that capability yet? (It would also be nice if it didn't append options that are the default anyway, such as ";a=summary").
Thanks in advance,
-Carl
PS. Oh, and then the final thing I'd want is to allow someone to cut and paste a gitweb URL such as the above to "git clone" and then some magic would forward things such that the git daemon would serve the data. Has anyone got that working? And for bonus points, it would also fail over to http:// cloning if git:// cloning weren't possible for some reason.
hoi :)
Quoted 4 lines · Carl Worth
Currently I've got gitweb running at the root URL on its own domain with the following apache configuration:
ScriptAlias /
/usr/lib/cgi-bin/gitweb
I use the following configuration:
DocumentRoot /pub/git
RewriteEngine on
RewriteRule ^/(.*\.git/(.*\.html)?)?$ /cgi-bin/gitweb.cgi%{REQUEST_URI} [L,PT]this has the advantage that normal http: repository accesses go to the normal web server and only gitweb accesses go to the CGI.
Quoted 4 lines
Finally, once I get that working, I would like gitweb to generate URLs of this form in the link it generates. Does it have that capability yet? (It would also be nice if it didn't append options that are the default anyway, such as ";a=summary").
I had this for an very old gitweb version and am currently reimplementing it for current gitweb versions.
Signature · 1 line
Martin Waitz